--TEST--
CTPP Load/Unload Parse/Save (OO-style)
--FILE--
<?php
	error_reporting(E_ERROR);

	ini_set("ctpp.arg_stack_size",       "10240");
	ini_set("ctpp.code_stack_size",      "10240");
	ini_set("ctpp.steps_limit",          "10240");
	ini_set("ctpp.cache_bytecode",       "0");
	ini_set("ctpp.max_functions",        "1024");

	// Create new class
	$T = new ctpp();

	if (is_object($T)) { echo "new ctpp: OK\n"; }
	else
	{
		echo "new ctpp: ERROR\n";
		exit();
	}

	// Load template
	$hello = $T -> parse_template("hello.tmpl");

	if (is_resource($hello)) { echo "parse_template: OK\n"; }
	else
	{
		echo "parse_template: ERROR\n";
		exit();
	}

	if ($T -> save_bytecode($hello, "hello.ct2")) { echo "save_bytecode: OK\n";    }
	else                                          { echo "save_bytecode: ERROR\n"; }

	if ($T -> save_bytecode($hello, "hello.ct2")) { echo "save_bytecode: OK\n";    }
	else                                          { echo "save_bytecode: ERROR\n"; }

	if ($T -> free_bytecode($hello)) { echo "free_bytecode: OK\n";    }
	else                             { echo "free_bytecode: ERROR\n"; }

	if ($T -> free_bytecode($hello)) { echo "free_bytecode: OK\n";    }
	else                             { echo "free_bytecode: ERROR\n"; }

	$hello = $T -> load_bytecode("hello.tmpl");

	if (is_resource($hello)) { echo "load_bytecode: OK\n";    }
	else                     { echo "load_bytecode: ERROR\n"; }

	$hello = $T -> load_bytecode("hello.ct2");

	if (is_resource($hello)) { echo "load_bytecode: OK\n"; }
	else
	{
		echo "load_bytecode: ERROR\n";
		exit();
	}

	if ($T -> free_bytecode($hello)) { echo "free_bytecode: OK\n";    }
	else                             { echo "free_bytecode: ERROR\n"; }

?>
--EXPECT--
new ctpp: OK
parse_template: OK
save_bytecode: OK
save_bytecode: OK
free_bytecode: OK
free_bytecode: ERROR
load_bytecode: ERROR
load_bytecode: OK
free_bytecode: OK